<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}

$lx=$_GET['lx'];
$act=$_GET['act'];
$wzxx_title ='认证中心-'.$wzxx_title.'';
$wzxx_gj    ='认证中心-'.$wzxx_gj.'';
$wzxx_ms    ='认证中心-'.$wzxx_ms.'';
	if($act == 'emailok'){
		 $uid=$_GET['uid'];
		 $email=$_GET['email'];
		 $hyuser=$db->get_one('user',"`email_d` = '2' and `uid` = '$uid' ",'');
		 $useremail=md5($hyuser['email']);
		 if($email == $useremail){
		    $db->update('user',array('email_d' => 1)," `uid` ='$uid'");
		    Bingz_message_post('0',$uid,'恭喜你！你提交的邮箱('.$hyuser['email'].')自动认证成功！');
		    $pdid='6';
		 }else{
		    $db->update('user',array('email_d' => 0)," `uid` ='$uid'");
		    Bingz_message_post('0',$uid,'你提交的邮箱('.$hyuser['email'].')自动认证失败！');
		    $pdid='7';
		 }		 	
	}elseif(!$user_uid){
		 $pdid='1';
	}elseif($act == 'mobile'){
		if(!preg_match("/^1[0-9]{1}[0-9]{9}$/",$_POST[name])){
       $pdid="3";
		}elseif($db->get_one('user',"`mobile` = '$_POST[name]' and `uid` != '$user_uid' ",'')){
       $pdid="4";
		}else{
			 $db->update('user',array('mobile' => $_POST[name])," `uid` ='$user_uid'");
			 $pdid="2";
	  }
		if($_POST[text] == '提交审核'){
		   $db->update('user',array('mobile_d' => 2)," `uid` ='$user_uid'");		
		   $pdid="2";
		}
	}elseif($act == 'email'){
		if(!preg_match("/^([0-9A-Za-z\-\_])+@([0-9a-zA-Z\.])+([0-9A-Za-z\.])+$/",$_POST[name])){
       $pdid="3";
		}elseif($db->get_one('user',"`email` = '$_POST[name]' and `uid` != '$user_uid' ",'')){
       $pdid="4";
		}else{
			 $db->update('user',array('email' => $_POST[name])," `uid` ='$user_uid'");
			 $pdid="2";
	  }
		if($_POST[text] == '提交认证'){
			 if(Bingz_config('email_set_renzheng') == '1'){
			 	$email_set_reg_title=Bingz_config('email_set_renzheng_title');
        $email_set_reg_body=Bingz_config('email_set_renzheng_body');
        $email_set_reg_body=str_replace('{url}',''.$httpurl.'/index.php?'.$Bingz_ml.'=user&amp;'.$Bingz_md.'=renzheng&amp;act=emailok&amp;uid='.$user_uid.'&amp;email='.md5($_POST[name]).'',$email_set_reg_body);
	   	  Bingz_email_smtp_post($_POST[name],$email_set_reg_title,$email_set_reg_body);
        $db->update('user',array('email_d' => 2)," `uid` ='$user_uid'");
        $pdid="5";
			 }else{
		   $db->update('user',array('email_d' => 2)," `uid` ='$user_uid'");
			 $pdid="2";
			 }
		}
	}elseif($act == 'qq'){
		if($db->get_one('user',"`qq` = '$_POST[name]' and `uid` != '$user_uid' ",'')){
       $pdid="4";
		}else{
		   $db->update('user',array('qq' => $_POST[name])," `uid` ='$user_uid'");
			 $pdid="2";
	  }
		if($_POST[text] == '提交审核'){
		   $db->update('user',array('qq_d' => 2)," `uid` ='$user_uid'");		
			 $pdid="2";
		}
	}else{
		 
		 $reg_sj=Bingz_config('user_config_reg_sms_phone');
		 $reg_sjrz=Bingz_config('user_config_reg_sjrz');
		 $reg_sjrm=Bingz_config('user_config_reg_sjrz_yzm');
		 $smz=$user[smz_name];
		 $smz_d=mb_substr($user[smz],0,13,"utf-8");
		 $qq=$user[qq];
		 $qq_d=$user[qq_d];
		 $email=$user[email];
		 $email_d=$user[email_d];
		 $mobile=$user[mobile];
		 $mobile_d=$user[mobile_d];
  }
@include template('head');
@include template('user/user_renzheng');
@include template('foot');
?>